import { defineStore } from 'pinia';

export const useProductStore = defineStore('product', {
  state: () => ({
    products: [],
  }),
  actions: {
    async fetchProducts() {
      // 实现从 API 或其他数据源获取产品列表的逻辑
      // 以下是模拟数据的示例
      this.products = [
        { id: 1, name: 'iPhone XS', description: '高性能的智能手机', price: 100,category:'category1'},
        { id: 2, name: 'iPhone XS', description: '高性能的智能手机', price: 100,category:'category1'},
        { id: 3, name: 'iPhone XS', description: '高性能的智能手机', price: 100,category:'category1'},
        { id: 4, name: 'iPhone XS', description: '高性能的智能手机', price: 100,category:'category1'},
        { id: 5, name: 'iPhone XS', description: '高性能的智能手机', price: 100,category:'category1'},
        { id: 6, name: 'iPhone XS', description: '高性能的智能手机', price: 100,category:'category1'},
        { id: 7, name: 'iPhone XS', description: '高性能的智能手机', price: 100,category:'category1'},
        { id: 8, name: 'iPhone XS', description: '高性能的智能手机', price: 100,category:'category1'},
      ];
    },
  },
});
